package chat.bean;

import java.sql.Timestamp;

import org.apache.logging.log4j.*;

import chat.*;

/**
 * 채팅 룸
 * @author sunabove
 *
 */
public class ChatRoom extends WebObject {

	private static final long serialVersionUID = -4265672250810357681L;
	/**
	 * Log4j logger
	 */
	static final Logger logger = LogManager.getLogger(ChatRoom.class); 

	private static int CHAT_ROOM_ID = 1;
	
	private int chatRoomId = CHAT_ROOM_ID ++;
	private String chatRoomUserName = null;
	private String chatRoomName = null ;
	private ChatMsgList chatMsgList = null ;
	private Timestamp chatRoomCreDate ;
	
	/**
	 * 생성자
	 */
	public ChatRoom() {
		this.chatRoomUserName = "";
		this.chatRoomName = "";
		this.chatMsgList = new ChatMsgList();
		this.chatRoomCreDate = new Timestamp( System.currentTimeMillis() );
	} 
	
	public int getChatRoomId() {
		return chatRoomId;
	} 

	public void setChatRoomId(int chatRoomId) {
		this.chatRoomId = chatRoomId;
	} 
	
	public ChatMsgList getChatMsgList() {
		return this.chatMsgList;
	}

	public void setAddChatMsg( ChatMsg chatMsg ) {
		this.chatMsgList.add( chatMsg );
	}
	
	/**
	 * 채팅방 표출 이름.
	 * 방제가 없으면 방제 없음 이라고 표출한다.
	 * @return
	 */
	public String getChatRoomDispName() {
		if( this.chatRoomName == null || this.chatRoomName.length() < 1 ) {
			return "방제 없음";
		}
		
		return this.chatRoomName;
	}

	public String getChatRoomName() {
		return chatRoomName;
	}

	public void setChatRoomName(String chatRoomName) {
		this.chatRoomName = chatRoomName;
	} 

	public String getChatRoomUserName() {
		return chatRoomUserName;
	}

	public void setChatRoomUserName(String chatRoomUserName) {
		this.chatRoomUserName = chatRoomUserName;
	}

	public Timestamp getChatRoomCreDate() {
		return chatRoomCreDate;
	}

	public void setChatRoomCreDate(Timestamp chatRoomCreDate) {
		this.chatRoomCreDate = chatRoomCreDate;
	}  

}
